#ifndef __USER_H__
#define __USER_H__

// 头文件内容

#include"utils.h"
#include <sys/ipc.h>

typedef struct user
{

    char name[16]; 		//姓名
    char sex[5];        //性别
    char account[11];     //    唯一标识账号id
    char passwd[21];	//用户密码 
    char phone[12];      //手机号码  
    int status;         //qq等级   
}user_t;


//用户数据节点 - 单链表
typedef struct u_node
{
    user_t  user_data;
    struct u_node * next;
}u_node;

typedef struct u_list
{
    int len;
    u_node * next;
}u_list;


//好友列表
typedef struct FriendList
{
    char user_name[16];
    char firend[2048];   
}FriendList;

typedef struct friend_node
{
    FriendList  user_data;
    struct friend_node * next;
}friend_node;


typedef struct friend
{
    int len;
    friend_node * next;
}friend_list;


extern u_list* user;

u_list* init_list(void);
void init_list_random(int number);
void clear_link_list(void);

void Print_user_data(user_t user_data);
void f_Print(u_list* L) ;
int pos_insert_LinkList(user_t data,int pos);
void account_del_LinkList(char* account);
user_t find_userinfo(user_t info);

void f_All_Print(void) ;
user_t find_userinfo_passwd(user_t info);



friend_list* fri_init_list(void);
int fri_pos_insert_LinkList(FriendList data,int pos  ,friend_list* friend );
FriendList fri_find_userinfo(FriendList info , friend_list* friend );
int fri_alter_userinfo(FriendList info , friend_list* friend );
int fri_del_userinfo(FriendList info , friend_list* friend );
void fri_account_del_LinkList(FriendList info , friend_list* friend );
void fri_clear_link_list(friend_list* friend);
void friend_f_Scanf(friend_list* friend);
void friend_f_All_Print(friend_list* friend);
void friend_Print(friend_list* friend );
user_t find_friend_userinfo(user_t info);
#endif // __USER_H__
